<template>
    <div class="wrap">
        <ib-header :title="'发布'" :you="false"></ib-header>
        <div>
          <p>昵称：<input  v-model="data.name"></p>
          <p>标题：<input  v-model="data.title"></p>
          <p>时间：<input  v-model="data.time"></p>
          <p>内容：<input  v-model="data.con"></p>
        </div>
        <footer @click="Submit">
          确定
        </footer>
    </div>
    
</template>

<script>
import IbHeader from './Ib-header';
import IbCon from './Ib-con';
import axios from 'axios';
export default {
  components:{
        IbCon,
        IbHeader
  },
  data(){
    return {
        data:{
            name:"",
            title:"",
            time:"",
            con:"",
        }
    }
  },
  methods:{
      Submit(){
      axios.post("/insert",this.data).then((res) => {
        if(res.data.code == 0){
          console.log(res.data.asg)
          this.$emit("Submit",res.data.asg)
        }else{
          console.log(res.data.asg) 
        }
      })
    }
  }
}
</script>

<style scoped lang="scss">
   .wrap{
       width: 100%;
       height: 100%;
       position: fixed;
       left: 0;
       top:0;
       background: #fff;
       padding-top: 50px;
   }
   div{
        margin: 10px 0;
        padding: 0 10px;
        border: 1px solid red;
        input{
            outline: none;
            border: none;
            border-bottom: 1px solid #ccc;
            padding: 10px;
        }
    }
</style>
